home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
VS_804.ARJ
/
MISC.EXE
/
FUNC2DOC.PRG
< prev
next >
Wrap
Text File
|
1991-10-26
|
7KB
|
289 lines
* Filename......: Func2Doc.Prg
*
* Author........: Vernon E. Six, Jr.
* 2908 Forest Hollow Lane #2329
* Arlington, Texas 76006
* Ph: (214) 283-3282 - Voice
* Ph: (817) 695-0058 - BBS
*
* Last Update...: Sun 10-13-1991 02:42:29
*
* Notice........: Copyright (c) 1991 by Vernon E. Six, Jr.
* All Rights Reserved World Wide
#include "FILEIO.CH"
#include "SETCURS.CH"
STATIC SC_NOTE_1 := "Vern Six's Clipper ToolBox v8.00"
STATIC SC_NOTE_2 := "CopyRight (c) 1991 by Vernon E. Six, Jr. - All Rights Reserved"
STATIC SN_PAGE_LEN := 66
STATIC SN_TOP := 5
STATIC SN_BOTTOM := 10 // Must be AT LEAST 7!!!
STATIC SN_LINE := 0
STATIC SN_PAGE := 1
STATIC SL_BOLD := .F. // Bold Status
STATIC SL_UND := .F. // Underline Status
FUNCTION Func2Doc( pc_FileName, pc_Page )
*****
*
* Create a DOC file
*
* Requires FuncDoc.Dbf
*
* # Field Name Type Len Dec
* --------------------------------
* 1 FUNC_NAME C 10 0
* 2 SHORT C 56 0 // Changed
* 3 DESC M 10 0
* 4 SYNTAX M 10 0
* 5 PASS M 10 0
* 6 RETURN M 10 0
* 7 NOTES M 10 0
* 8 EXAMPLE M 10 0
* 9 USAGE M 10 0
* 10 SEEALSO M 10 0
*
*****
LOCAL c_FileName
LOCAL n_Handle
LOCAL n_CurrRec := 0
LOCAL a_TblCont := {}
VS_InitVern()
VS_NewScrn()
VS_InitPrtr()
*****
* Does the user want to start on a different page?
*****
IF pc_Page <> NIL
SN_PAGE = VAL(pc_Page)
ENDIF
*****
* Make sure he specified a filename
*****
IF PCOUNT() = 0
VS_TELL(3,0,"",PADC("Proper Syntax is: Func2Doc {FileName} [{page}] [Return]",60),"")
RETURN(NIL)
ENDIF
dbUseArea(,,pc_FileName,"FUNC_DOC")
dbCreateIndex( pc_FileName, "FUNC_NAME", {||FUNC_NAME}, .F. )
dbGoTop()
*****
* Open the .DATE file (since we are going to create it!)
*****
c_FileName = ALLTRIM(pc_FileName)+".TXT"
IF (n_Handle := FCREATE( c_FileName, 0 ) ) = F_ERROR
VS_TELL(3,0,PADC("Unable to create "+c_FileName))
RETURN(NIL)
ELSE
VS_Write(n_Handle)
ENDIF
VS_GrabScr()
VS_Palette(2)
VS_NewScrn()
VS_Wind(8,13,16,66,"","")
SETCURSOR(SC_NONE)
@ 10,15 SAY PADC("Fung2Doc.Exe Sat 10-26-1991 22:23:26",50)
@ 12,15 SAY PADC("Writing Data File!",50)
@ 14,15 SAY REPLICATE("░",50)
*****
* Top Margin
*****
FOR n_Cntr = 1 TO SN_TOP
VS_WriteLn( [] )
NEXT n_Cntr
SN_LINE = SN_TOP
DO WHILE .NOT. FUNC_DOC->( EOF() )
IF INKEY(.05) > 0
EXIT
ENDIF
n_CurrRec++
@ 14,15 SAY REPLICATE("█", VS_ScrlBar( n_CurrRec, 50, RECCOUNT() ))
*****
* Keep track of everything in the Table of Contents
*****
AADD( a_TblCont, { FUNC_DOC->FUNC_NAME, SN_PAGE } )
VS_WriteLn( SPACE(3)+ VS_Bold(FUNC_DOC->FUNC_NAME +SPACE(6)+ LEFT(FUNC_DOC->SHORT,50)) )
SN_LINE++
VS_WriteLn( [] )
SN_LINE++
WrtFld( "Description:", FUNC_DOC->DESC )
WrtFld( "Syntax: ", FUNC_DOC->SYNTAX )
WrtFld( "Pass: ", FUNC_DOC->PASS )
WrtFld( "Return: ", FUNC_DOC->RETURN )
WrtFld( "Notes: ", FUNC_DOC->NOTES )
WrtFld( "Example: ", FUNC_DOC->EXAMPLE )
WrtFld( "Usage: ", FUNC_DOC->USAGE )
WrtFld( "See Also: ", FUNC_DOC->SEEALSO )
Chk4NewPage(.T.)
FUNC_DOC->( dbSkip() )
ENDDO
FOR n_Cntr = 1 TO LEN( a_TblCont )
VS_WriteLn( a_TblCont[n_Cntr,1] + REPLICATE(".",50) + ;
ALLTRIM(STR(a_TblCont[n_Cntr,2])) )
NEXT n_Cntr
VS_PutScr()
dbCloseAll()
RETURN(NIL)
*** EOF: Func2Doc() *********************************************************
FUNCTION WrtFld( pc_Hdr, pc_Text )
*****
* Prints the specified memo field
*****
LOCAL n_Cntr
LOCAL c_OutLine := ""
LOCAL n_Pos := 0
VS_WriteLn( SPACE(3) + VS_Bold(pc_Hdr) )
SN_LINE++
Chk4NewPage()
FOR n_Cntr = 1 TO MLCOUNT(pc_Text,70)
c_OutLine = MEMOLINE( pc_Text, 70, n_Cntr )
VS_Write ( SPACE(5) )
DO WHILE LEN(c_OutLine) > 0
IF (n_Pos := AT("^",c_OutLine)) = 0
VS_Write ( c_OutLine )
c_OutLine = ""
LOOP
ENDIF
IF n_Pos > 1
VS_Write ( SUBSTR(c_OutLine,1,n_Pos-1) )
ENDIF
DO CASE
CASE SUBSTR(c_OutLine,n_Pos,2) = "^B"
VS_Write ( IF(SL_BOLD,VS_BoldOff(),VS_BoldOn()) )
SL_BOLD = IF(SL_BOLD,.F.,.T.)
CASE SUBSTR(c_OutLine,n_Pos,2) = "^U"
VS_Write ( IF(SL_UND,VS_UndOff(),VS_UndOn()) )
SL_UND = IF(SL_UND,.F.,.T.)
ENDCASE
IF n_Pos < (LEN(c_OutLine)-1)
c_OutLine = SUBSTR(c_OutLine,n_Pos+2)
ELSE
c_OutLine = ""
ENDIF
ENDDO
VS_WriteLn( [] )
SN_LINE++
Chk4NewPage()
NEXT n_Cntr
VS_WriteLn( [] )
SN_LINE++
Chk4NewPage()
RETURN(.T.)
*** EOF: WrtFld() ***********************************************************
FUNCTION Chk4NewPage(pl_ForcePage)
*****
* Checks to see if we need a new page
*****
LOCAL n_Cntr
IF pl_ForcePage = NIL
IF SN_LINE < (SN_PAGE_LEN-SN_BOTTOM)
RETURN(NIL)
ENDIF
ENDIF
DO WHILE SN_LINE < (SN_PAGE_LEN-SN_BOTTOM)
VS_WriteLn( [] )
SN_LINE++
ENDDO
VS_WriteLn( [] )
SN_LINE++
VS_WriteLn( [] )
SN_LINE++
VS_WriteLn( PADC( SC_NOTE_1, 80 ) )
SN_LINE++
VS_WriteLn( PADC( SC_NOTE_2, 80 ) )
SN_LINE++
VS_WriteLn( [] )
SN_LINE++
VS_WriteLn( PADC( "- "+ALLTRIM(STR(SN_PAGE))+" -", 80 ) )
SN_LINE++
DO WHILE SN_LINE < SN_PAGE_LEN
VS_WriteLn( [] )
SN_LINE++
ENDDO
*****
* Top Margin
*****
FOR n_Cntr = 1 TO SN_TOP
VS_WriteLn( [] )
NEXT n_Cntr
SN_LINE = SN_TOP
SN_PAGE++
RETURN(NIL)
*** EOF: Chk4NewPage() ******************************************************